#include <stdint.h>

#include <fdb.h>
#include <fdb-helpers.h>

int main(int argc, char *argv[]) {
	database_t *database;
	table_t *table;
	transaction_t *transaction;
	helper_sequence_t sequence;

	if (argc < 2)
		return 1;

	database = database_open(argv[1]);

	table = table_new("data");
	table_add_column(table, column_new("pkey", "int64", NULL));
	table_add_column(table, column_new("second", "string", NULL));
	database_table_create(database, table);
	table_destroy(table);

	table = table_new("flat");
	table_add_column(table, column_new("text", "string", NULL));
	database_table_create(database, table);
	table_destroy(table);

	/* Initialize sequence. */
	helper_sequence_create_table(database, "sequence");
	helper_sequence_init(&sequence);
	sequence.name = "data_pkey_sequence";
	sequence.value = 0;
	transaction = transaction_begin(database, READ_COMMITTED);
	helper_sequence_create_sequence(transaction, "sequence", &sequence);
	transaction_commit(transaction);

	database_close(database);

	return 0;
}

